﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
using LY.Manage.IDAL;
using System.Reflection;

namespace LY.Manage.DALFactory
{
    /// <summary>
    /// 通过反射创建类的实例
    /// </summary>
    public partial class AbstractFactory
    {
        //AssemblyPath
        private static readonly String AssemblyPath =
            ConfigurationManager.AppSettings["AssemblyPath"];
        private static readonly String NameSpace =
           ConfigurationManager.AppSettings["NameSpace"];

        //public static IUserInfoDal CreateUserInfoDal()
        //{
        //    string fullClassName = NameSpace + ".UserInfoDal";
        //    return CreateInstance(fullClassName) as IUserInfoDal;
        //}

        private static Object CreateInstance(string className)
        {
            var assembly=Assembly.Load(AssemblyPath);
            return assembly.CreateInstance(className);
        }


    }
}
